<#--
===================================================================
MACRO: showType
INPUT: obj: Object // 
INPUT: path: String // 
===================================================================
-->
<#macro showType typeId typeMap path='' stringutil='' length=0>
<#if typeId?? && typeMap??>
	<#list typeMap[typeId] as obj>
	<li>
	<a href="<#if obj.titleface?? && obj.titleface!=''>${obj.titleface}" target="_blank<#else>${path}detail.do?id=${obj.id}</#if>" title="${obj.title!}"><#t>
	<font color="${obj.titlecolor!}"><#if (stringutil!='' && obj.title?length>length)>${stringutil.substring(obj.title!, length)}...<#else>	${obj.title!}</#if></font><#t>
	</a><#t>
	<#if obj.n?? && obj.n?string=='1'> <img src="images/new.gif" align="absmiddle">
	<#elseif obj.picnews?? && obj.picnews?string=='1'> <img src="images/pic.gif" align="absmiddle">
	<#elseif obj.istop?? && obj.istop?string=='1'> <img src="images/top.gif" align="absmiddle">
	<#elseif obj.daodu?? && obj.daodu?string=='1'> <img src="images/daodu.gif" align="absmiddle">
	<#elseif obj.goodnews?? && obj.goodnews?string=='1'> <img src="images/good.gif" align="absmiddle">
	</#if>
	</li>	
	</#list>
</#if>
</#macro>


<#--
===================================================================
MACRO: showTitle
INPUT: obj: Object // 
INPUT: path: String // 
===================================================================
-->
<#macro showTitle obj path='' stringutil='' length=0>
	<a href="<#if obj.titleface?? && obj.titleface!=''>${obj.titleface}" target="_blank"<#else>javascript:window.parent.open('查看信息','info/newsView.do?newsid=${obj.id!}')"</#if> title="${obj.title!}"><#t>
	<font color="${obj.titlecolor!}"><#if (stringutil!='' && obj.title?length>length)>${stringutil.substring(obj.title!, length)}...<#else>	${obj.title!}</#if></font><#t>
	</a><#t>
	<#if obj.n?? && obj.n?string=='1'> <img src="../images/news/new.gif">
	<#elseif obj.istop?? && obj.istop?string=='1'> <img src="../images/news/top.gif">
	<#elseif obj.daodu?? && obj.daodu?string=='1'> <img src="../images/news/jing.gif">
	<#elseif obj.goodnews?? && obj.goodnews?string=='1'> <img src="../images/news/jian.gif">
	</#if>
</#macro>

<#--
===================================================================
MACRO: selectMode
INPUT: selectName: string // 
INPUT: selected: int // 
===================================================================
-->
<#macro selectMode selectName='mode' selected=1>
	<select size="1" name="${selectName}" style="font-family: 宋体; font-size: 9pt" >
	<option <#if selected==1> selected </#if> value="1">新闻媒体模板</option>
	<option <#if selected==2> selected </#if> value="2">单独页面模板</option>
	</select>
</#macro>

<#--
===================================================================
MACRO: showTree
INPUT: nodes: list // 
===================================================================
-->
<#macro showTree nodes=[] qxcd=[]>
	<#list nodes as node>
		<#if qxcd?size==0 || qxcd?contains(node.id?string)>
		d.add(${node.id}, ${node.fid}, '${node.name}', '<#if node.children?size==0>adminNewsManage!add.do?typeid=${node.id}</#if>', '${node.content}');
		</#if>
		<@showTree nodes=node.children qxcd=qxcd/>
	</#list>
</#macro>

<#--
===================================================================
MACRO: showEditTree
INPUT: nodes: list // 
===================================================================
-->
<#macro showEditTree nodes=[] qxcd=[]>
	<#list nodes as node>
		<#if qxcd?size==0 || qxcd?contains(node.id?string)>
		d.add(${node.id}, ${node.fid}, '${node.name}', 'javascript:submit(${node.id})', '${node.content}');
		</#if>
		<@showTree nodes=node.children qxcd=qxcd/>
	</#list>
</#macro>

<#--
===================================================================
MACRO: selectRange
INPUT: optName: string // 
	   start: int //
	   end: int //
	   optVal: int //
       all: boolean // 
===================================================================
-->
<#macro selectRange optName start=2010 end=2020 optVal=2010 all=true>
<#setting number_format="0">
<select name="${optName}" <#nested/>>
<#if all><option value=""> -- 请选择 -- </option></#if>
<#list start..end as key>
<option value="${key}" <#if key?string==optVal?string>selected</#if>>${key}</option>
</#list>
</select>
</#macro>

<#--
===================================================================
MACRO: selectUtil
INPUT: optName: string // 
	   optVals: map //
       all: boolean // 
===================================================================
-->
<#macro selectUtil optName optVals optVal='' all=true>
<select name="${optName}" <#nested/>>
<#if all><option value=""> -- 请选择 -- </option></#if>
<#list optVals as opt>
<option value="${opt.mxdm}" <#if opt.mxdm?string==optVal?string>selected</#if>>${opt.mxmc}</option>
</#list>
</select>
</#macro>

<#macro radioUtil optName optVals optVal=''>
<#list optVals as opt>
<input type="radio" name="${optName}" value="${opt.key}" <#if optVal?string==''&&opt_index==0>checked</#if> <#if opt.key?string==optVal?string>checked</#if> <#nested/>/>${opt.value}
</#list>
</#macro>

<#macro pageUtil pager prevLabel="上一页" nextLabel="下一页" more=false>
<#local url=pager.url>
<#local params=pager.params>
<#local page=pager.page>
<#local pages=pager.pages>
<script type="text/javascript">
function _pagesubmit(page)
{
	document._page.page.value = page;
	document._page.submit();
}
</script>
<form name="_page" method="post" action="${url}">
<input type="hidden" name="page" value="1">
<#list params?keys as k>
<input type="hidden" name="${k}" value="${params[k]!}" />
</#list>
<div style="vertical-align:middle">
<#if (pages > 1)>
  <a href="javascript:_pagesubmit(1);">首页</a>
  <#if ((page-1) > 0)>
  <a href="javascript:_pagesubmit(${page-1});">${prevLabel}</a>
  </#if>
  <#if more>
    <#if ((page-3) > 0)>
      <a href="javascript:_pagesubmit(${page-3});">${page-3}</a>
    </#if>
    <#if ((page-2) > 0)>
      <a href="javascript:_pagesubmit(${page-2});">${page-2}</a>
    </#if>
    <#if ((page-1) > 0)>
      <a href="javascript:_pagesubmit(${page-1});">${page-1}</a>
    </#if>
    <#if (page > 0)>
    <a href="javascript:_pagesubmit(${page});">${page}</a>
    </#if>
    <#if ((page+1) < pages)>
      <a href="javascript:_pagesubmit(${page+1});">${page+1}</a>
    </#if>
    <#if ((page+2) < pages)>
      <a href="javascript:_pagesubmit(${page+2});">${page+2}</a>
    </#if>
    <#if ((page+3) < pages)>
      <a href="javascript:_pagesubmit(${page+3});">${page+3}</a>
    </#if>
  </#if>
  <#if ((page+1) <= pages)>
    <a href="javascript:_pagesubmit(${page+1});">${nextLabel}</a>
  </#if>
  <a href="javascript:_pagesubmit(${pages});">尾页</a>
</#if>
&nbsp;&nbsp; 
<#if (page > 0) && (pages > 0)>
共${pager.total!1}条记录，每页<input type="text" size="2" value="${pager.rows!}" name="rows">条，当前第<input type="text" size="2" value="${page!1}" name="pn">/${pages!1}页
&nbsp;&nbsp;<input type="button" class="button_38px" value="跳转" onclick="_pagesubmit(document._page.pn.value);">
</#if>
<#nested/>
</div>
</form>
</#macro>
